#include "stm32f10x.h"                  // Device header

#include "stdio.h"

#include "def.h"
#include "dev.h"
#include "sys.h"

void SHOW_Init(void)
{
	OLED_ShowString(2,0,(u8*)"CYIOT-X",12);
	OLED_ShowString(2,12,(u8*)devID,12);
	OLED_Refresh_Gram();
}

void DeviceInit(void)
{
	
	DEF_Init();
	OLED_Init();
	SHOW_Init();
	USART2_Init(115200);
	//USART3_Init(115200);
	U3_Configuration(115200);
	U3_DMA_Init();
	delay_init();
	ESP_Init();
	TIM2_Init();
	//IWDG_Init();
}

int main(void)
{
 
  // System Initialization
  //SystemCoreClockUpdate();
  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);	//设置NVIC中断分组2  2位抢占优先级，2位响应优先级
	
	DeviceInit();
	
	

  while(1)
	{
		printf("..................................\r\n");
		char *p=malloc(100);
		service_conn();
		delay_ms(1000);
	}
}
